#ifndef BUTTONMANAGER_H
#define BUTTONMANAGER_H

#include <QObject>
#include <QMap>
#include <QMutex>
#include <QWaitCondition>

class ButtonManager : public QObject
{
    Q_OBJECT
public:
    static ButtonManager* instance();

    // 用于后端获取按钮点击信息
    QMap<int, bool> getButtonStates();
    void resetButtonStates();

signals:
    void buttonClicked(int buttonId);

public slots:
    void handleButtonClick(int buttonId);

private:
    ButtonManager();
    static ButtonManager* m_instance;
    static QMutex mutex; // 修改为静态成员
    QWaitCondition waitCondition;
    QMap<int, bool> buttonStates;
};

#endif // BUTTONMANAGER_H
